﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using Sustainalytics.DataLayer.EsgRatings;
using Sustainalytics.DataLayer.Shared;
using Sustainalytics.ESG.Entities;
using Sustainalytics.Utils;

namespace Sustainalytics.DataLayer.Tests.ESGRatings
{
    [TestClass]
    public class RPIndicatorsRepositoryIntegrationTest
    {
        private const string ConnectionString = "mongodb://localhost:27017/ClientDW";
        private IRPIndicatorsRepository<IndicatorTemplate> _repository;
        private IRepositoryCollection<RPIndicatorExtended> _stardardRepo;

        [TestInitialize]
        public void Initialize()
        {
            _repository = new RPIndicatorsRepository<IndicatorTemplate>(ConnectionString, "IndicatorTemplate");
            _stardardRepo = new StandardIndicatorsRepository(ConnectionString);
        }

        [TestMethod]
        public void GetClusters_NotEmpty_Test()
        {
            var items = _repository.GetDistinctByFields<Cluster>(x => x.ThemeName == "Governance", x => x.IndicatorCategory, x => x.IndicatorCategorySortKey);
            Assert.IsFalse(items.IsNullOrEmpty());
        }
    }
}
